package me.tuyou.rmi.java;

import me.tuyou.rmi.java.service.MyService;
import me.tuyou.rmi.java.service.impl.MyServiceImpl;

import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @Description
 * @Author tuyou_cd
 * @Date 2020/6/19 15:37
 */
public class RMIServerApp {

    public static void main(String[] args) throws RemoteException, AlreadyBoundException {
        MyService myService = new MyServiceImpl();

        LocateRegistry.createRegistry(1099);
        Registry registry = LocateRegistry.getRegistry();
        registry.bind("myService", myService);
        System.out.println("server ready");
    }
}
